from django.db import models

# Create your models here.


from django.db import models

# Create your models here.
'''教室'''
class ClassroomManagement(models.Model):  ##教室
    name = models.CharField(max_length=16,verbose_name='教室名称')
    people = models.PositiveIntegerField(max_length=16,verbose_name='人数')
    theory_Classroom = models.BooleanField(null=True,verbose_name='理论教室')
    img = models.ImageField(upload_to='img/jiaoshi_img/',null=True,blank=True,verbose_name='图片')
    class Meta():
        verbose_name_plural = '教室信息'
    def __str__(self):
        return f"{self.name}"
'''设备'''
class device(models.Model):
    # order_number = models. ##序号
    Device_name = models.CharField(max_length=18,verbose_name='设备名')
    IMEI = models.PositiveIntegerField(max_length=16,verbose_name='IMEI')
    img = models.FileField(upload_to='img/device.img/',null=True,blank=True,verbose_name='图片')
    judge_normal = models.BooleanField(null=True,verbose_name='判断是否正常')
    d_Classroom = models.ForeignKey(to='ClassroomManagement',on_delete=models.CASCADE,to_field='id',verbose_name='所属教室')

    class Meta():
        verbose_name_plural = '设备信息'
    def __str__(self):
        return f'{self.Device_name}'

'''教室卫生'''
class Classroom_cleaning(models.Model):

    RATING_CHOICES = [
        ('1', '极差'),
        ('2', '差'),
        ('3', '一般'),
        ('4', '良好'),
        ('5', '优秀'),
    ]
    order_Pname = models.CharField(max_length=16,verbose_name='清洁人员名称')
    health = models.CharField(choices=RATING_CHOICES, max_length=1,verbose_name='卫生情况')
    order_Classroom = models.ForeignKey(to='ClassroomManagement',on_delete=models.CASCADE,to_field='id',verbose_name='所属教室')
    commander = models.CharField(max_length=10,verbose_name='负责人')
    cleaning_time = models.DateTimeField(verbose_name='清洁时间')
    img = models.ImageField(upload_to='img/Classroom_cleaning/',null=True,blank=True,verbose_name='图片')

    class Meta():
        verbose_name_plural = '卫生清洁信息'
    def __str__(self):
        return f'{self.pk}'













